/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.edu.fanor.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author JOSUÉ
 */
@Entity
@Table(name = "reserva_filme", catalog = "video_locadora", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ReservaFilme.findAll", query = "SELECT r FROM ReservaFilme r"),
    @NamedQuery(name = "ReservaFilme.findByIdReserva", query = "SELECT r FROM ReservaFilme r WHERE r.idReserva = :idReserva"),
    @NamedQuery(name = "ReservaFilme.findByData", query = "SELECT r FROM ReservaFilme r WHERE r.data = :data")})
public class ReservaFilme implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_reserva", nullable = false)
    private Long idReserva;
    @Column(name = "data")
    @Temporal(TemporalType.DATE)
    private Date data;
    @JoinColumn(name = "filme_id_filme", referencedColumnName = "id_filme", nullable = false)
    @ManyToOne(optional = false)
    private Filme filmeIdFilme;
    @JoinColumn(name = "Usuario_id_usuario", referencedColumnName = "id_usuario", nullable = false)
    @ManyToOne(optional = false)
    private Usuario usuarioidusuario;

    public ReservaFilme() {
    }

    public ReservaFilme(Long idReserva) {
        this.idReserva = idReserva;
    }

    public Long getIdReserva() {
        return idReserva;
    }

    public void setIdReserva(Long idReserva) {
        this.idReserva = idReserva;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public Filme getFilmeIdFilme() {
        return filmeIdFilme;
    }

    public void setFilmeIdFilme(Filme filmeIdFilme) {
        this.filmeIdFilme = filmeIdFilme;
    }

    public Usuario getUsuarioidusuario() {
        return usuarioidusuario;
    }

    public void setUsuarioidusuario(Usuario usuarioidusuario) {
        this.usuarioidusuario = usuarioidusuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idReserva != null ? idReserva.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReservaFilme)) {
            return false;
        }
        ReservaFilme other = (ReservaFilme) object;
        if ((this.idReserva == null && other.idReserva != null) || (this.idReserva != null && !this.idReserva.equals(other.idReserva))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.edu.fanor.entidades.ReservaFilme[ idReserva=" + idReserva + " ]";
    }
    
}
